#include<bits/stdc++.h>
#define ONLINE_JUDGE
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 2e5 + 10, INF = 0x3f3f3f3f;

int n, q;
ull pw[N];

struct tree
{
    ull v[N];
    int lowbit(int x) { return x & -x; }
    void add(int x, ull y)
    {
        for (; x <= n; x += lowbit(x))
            v[x] += y;
    }
    ull ask(int x)
    {
        ull ret = 0;
        for (; x; x -= lowbit(x))
            ret += v[x];
        return ret;
    }
} a, b;

void solve()
{
    pw[0] = 1;for (int i = 1;i < N;i++) pw[i] = pw[i - 1] * 1000000007;
    cin >> n >> q;
    for (int i = 1;i <= n;i++) {
        int x; cin >> x;
        a.add(i, pw[x]);
    }
    for (int i = 1;i <= n;i++) {
        int x; cin >> x;
        b.add(i, pw[x]);
    }

    int l, r, L, R;
    for (int i = 1;i <= q;i++) {
        cin >> l >> r >> L >> R;
        ull t1 = a.ask(r) - a.ask(l - 1);
        ull t2 = b.ask(R) - b.ask(L - 1);
        if (t1 == t2) cout << "Yes\n";
        else cout << "No\n";
    }
}

signed main()
{
    // ios::sync_with_stdio(0);
    // cin.tie(0);cout.tie(0);
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}